<?php 
    include 'cabecalho.php';
    
    if($nivel >=2 || $nivel == null){
        header("location: index.php");
    }
    if($_GET['iddica'] == null){
        header("location: caddica.php");
    }
    
    $objdica = new Dica();
    
    $iddica = $objdica->iddica = $_GET['iddica'];

    $itemdica = $objdica->retornarunico();

    if(isset($_POST['submit'])){
       
        $objdica->trad_dica  = pg_escape_string($_POST["trad_dica"]);
        
        $objdica->atualizar();
        
        echo "<script>alert('Dica atualizada.');</script>";
        
        header("location: caddica.php?iddica=$iddica");
        
    }
    
   

?>
                
             
<div class="voltar"><a href="caddica.php" ><img src="../imagens/back_arrow_mini.png">Listagem</a></div>
                <h1>Editar Dica</h1><br /><br />
                
                <div class="formulario">
                    <form method="POST" action="caddica-upd.php?iddica=<?php echo $iddica; ?>">
                        <label >País:</label>
                        <p style="font-weight:bold;" ><?php echo "$itemdica->nome_pais"; ?></p><br />
                        <label >Idioma:</label>
                        <p style="font-weight:bold;" ><?php echo "$itemdica->nome_idioma"; ?></p>     
                                
                            

                         <br /><br />

                        <label >Resposta:</label>
                        <textarea name="trad_dica" required maxlength="500" rows="11" cols="45"><?php echo filter_var($itemdica->trad_dica,FILTER_SANITIZE_SPECIAL_CHARS); ?></textarea><br /><br />
                        <label ></label>
                        <input type="submit" name="submit" value="Alterar"  ><br />
                        
                    </form>
                </div>
                
                
                
                
                
<?php 
    include 'rodape.php';
?>

                